The Algebra and the Logic for SQL Nulls
نویسندگان
چکیده
The logic of nulls in databases has been subject of investigation since their introduction in Codd’s Relational Model, which is the foundation of the SQL standard. In the logic based approaches to modelling relational databases proposed so far, nulls are considered as representing unknown values. Such existential semantics fails to capture the behaviour of the SQL standard. We show that, according to Codd’s Relational Model, a SQL null value represents a non-existing value; as a consequence no indeterminacy is introduced by SQL null values. We show that the domain independent fragment of the extension of first-order logic accounting for predicates with missing arguments is equivalent to Codd’s relational algebra with SQL nulls. Moreover, we illustrate a faithful encoding of the logic into standard first-order logic. At the end, we show how to capture in this framework the UNIQUE, PRIMARY KEY, and FOREIGN KEY constraints as defined in the SQL:1999 standard. 1 Relational Databases and SQL Null Values Consider a database instance with null values over the relational schema {R/2}, and an SQL query asking for the tuples in R being equal to themselves: R : 1 2 a b b N SELECT * FROM R WHERE R.1 = R.1 AND R.2 = R.2 ; ⇒ 1 | 2 ---+--a | b (1 row)
منابع مشابه
On the Logic of SQL Nulls
The logic of nulls in databases has been subject of investigation since their introduction in Codd’s Relational Model, which is the foundation of the SQL standard. In the logic based approaches to modelling relational databases proposed so far, nulls are considered as representing unknown values. Such existential semantics fails to capture the behaviour of the SQL standard. We show that, accord...
متن کاملA Formal Semantics of SQL Queries, Its Validation, and Applications
While formal semantics of theoretical languages underlying SQL have been provided in the past, they all made simplifying assumptions ranging from changes in the syntax to omitting bag semantics and nulls. This situation is reminiscent of what happens in the field of programming languages, where semantics of formal calculi underlying the main features of languages are abundant, but formal semant...
متن کاملOn the Codd Semantics of SQL Nulls
Theoretical models used in database research often have subtle differences with those occurring in practice. One particular mismatch that is usually neglected concerns the use of marked nulls to represent missing values in theoretical models of incompleteness, while in an SQL database these are all denoted by the same syntactic NULL object. It is commonly argued that results obtained in the mod...
متن کاملA SQL’s Three-Valued Logic and Certain Answers
The goal of the paper is to bridge the difference between theoretical and practical approaches to answering queries over databases with nulls. Theoretical research has long ago identified the notion of correctness of query answering over incomplete data: one needs to find certain answers, which are true regardless of how incomplete information is interpreted. This serves as the notion of correc...
متن کاملEQ-logics with delta connective
In this paper we continue development of formal theory of a special class offuzzy logics, called EQ-logics. Unlike fuzzy logics being extensions of theMTL-logic in which the basic connective is implication, the basic connective inEQ-logics is equivalence. Therefore, a new algebra of truth values calledEQ-algebra was developed. This is a lower semilattice with top element endowed with two binary...
متن کامل